import Vue from 'vue'
import VueRouter from 'vue-router'
//引入首页
import Home from '../views/Home.vue'
//引入登录页
import login from '../views/login.vue'
//引入注册页
import regist from '../views/regist.vue'
//引入文章详情页
import details from '../views/details'
//引入个人中心
import PersonalPage from '../views/personal/index.vue'
//引入编辑页
import editPage from '../views/personal/edit.vue'
//引入关注页
import attention from '../views/personal/attention.vue'
//引入我的跟帖页
import myfollow from '../views/personal/myfollow.vue'

//引入评论列表页
import comment from '../views/commentPage'
//引入收藏页
import star from '../views/personal/star.vue'
//引入搜索页
import search from '../views/search'
//引入栏目管理页
import management from '../views/management.vue'
//引入测试页
import testPage from '../views/test'
import testz from '../views/testz'
import teststar from '../views/testStar'
//挂载路由
Vue.use(VueRouter)
//路由配置
const routes = [
  {
    //主页路由
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    //登录页
    path: '/login',
    name: 'login',
    component: login
  },
  {
    //注册页
    path: '/register',
    name: 'register',
    component: regist
  },
  {
    //文章详情页
    path: '/details/:id',
    name: 'detailsPage',
    component: details
  },
  {
    //评论列表页
    path: '/comment/:id',
    name: 'commentPage',
    component: comment
  },
  {
    //个人中心
    path: '/personal',
    name: 'personalIndex',
    component: PersonalPage,
    meta: {
      auth: true
    }
  },
  {
    //编辑页
    path: '/edit',
    name: 'editIndex',
    component: editPage,
    meta: {
      auth: true
    }
  },
  {
    //关注页
    path: '/attention',
    name: 'attentionPage',
    component: attention
  },
  {
    //收藏页
    path: '/star',
    name: 'starPage',
    component: star
  },

  {
    //我的跟帖页
    path: '/myfollow',
    name: 'myfollowPage',
    component: myfollow
  },
  {
    //搜索页
    path: '/search',
    name: 'searchPage',
    component: search
  },
  {
    //栏目管理页
    path: '/management',
    name: 'managementPage',
    component: management
  },
  {
    //测试页
    path: '/test',
    name: 'testIndex',
    component: testPage
  },
  {
    //测试页
    path: '/testz',
    name: 'testzIndex',
    component: testz
  },
  {
    //收藏测试页
    path: '/teststar',
    name: 'testStarIndex',
    component: teststar
  }
]
//创建路由对象
const router = new VueRouter({
  routes
})
//默认输出（暴露router）
export default router
